//
//  HeroView.m
//  WhoElse
//
//  Created by 孙宇鹏 on 15/11/18.
//  Copyright © 2015年 sunsystem. All rights reserved.
//

#import "HeroView.h"

@implementation HeroView

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        [self updateGUI];
    }
    return self;
}

-(void)updateGUI{
    
    //
    self.backgroundColor = [UIColor whiteColor];
    
    //
    self.freeBT = [UIButton buttonWithType:(UIButtonTypeSystem)];
    self.freeBT.frame = CGRectMake(0, kBarHeight, kWidth / 3, 40);
    [self.freeBT setTitle:@"周免英雄" forState:(UIControlStateNormal)];
    [self.freeBT setTitleColor:[UIColor orangeColor] forState:(UIControlStateNormal)];
    [self.freeBT setTitleColor:[UIColor brownColor] forState:(UIControlStateSelected)];
    self.freeBT.selected = YES;
    self.freeBT.tintColor = [UIColor clearColor];
    [self addSubview:self.freeBT];
    
    self.myHeroBT = [UIButton buttonWithType:(UIButtonTypeSystem)];
    self.myHeroBT.frame = CGRectMake(MaxX(self.freeBT), kBarHeight, kWidth / 3, HEIGHT(self.freeBT));
    [self.myHeroBT setTitle:@"我的英雄" forState:(UIControlStateNormal)];
    [self.myHeroBT setTitleColor:[UIColor orangeColor] forState:(UIControlStateNormal)];
    [self.myHeroBT setTitleColor:[UIColor brownColor] forState:(UIControlStateSelected)];
    self.myHeroBT.selected = YES;
    self.myHeroBT.tintColor = [UIColor clearColor];
    [self addSubview:self.myHeroBT];

    self.allHeroBT = [UIButton buttonWithType:(UIButtonTypeSystem)];
    self.allHeroBT.frame = CGRectMake(MaxX(self.myHeroBT), kBarHeight, kWidth / 3, HEIGHT(self.myHeroBT));
    [self.allHeroBT setTitle:@"我的英雄" forState:(UIControlStateNormal)];
    [self.allHeroBT setTitleColor:[UIColor orangeColor] forState:(UIControlStateNormal)];
    [self.allHeroBT setTitleColor:[UIColor brownColor] forState:(UIControlStateSelected)];
    self.allHeroBT.selected = YES;
    self.allHeroBT.tintColor = [UIColor clearColor];
    [self addSubview:self.allHeroBT];
    
    //
    self.freeBT.tag = 1001;
    self.myHeroBT.tag = 1002;
    self.allHeroBT.tag = 1003;
    
    self.selectBT = self.freeBT;
    
    self.grayV = [[UIView alloc]initWithFrame:CGRectMake(0, MaxY(self.freeBT), MaxX(self.freeBT), 2)];
    self.grayV.backgroundColor = [UIColor grayColor];
    [self addSubview:self.grayV];
    

    
}

@end
